package com.ahui.service.impl;

import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import com.ahui.domain.BondAccount;
import com.ahui.service.BondAccountService;
import com.ahui.service.FileProcess;
import com.ahui.util.*;
import com.alibaba.excel.util.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPath;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Service;

import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

/**
 * @author : ph.li
 * @date : 2023/9/1 17:29
 */
@Service
@Slf4j
public class BondAccountServiceImpl implements BondAccountService {
    // 华安表格识别模型，提取表格准确率测试（账户信息表）
    @Override
    public void newaccount() {
        String inputPath = "E:\\文档\\工作\\致宇\\兴证全球\\数据处理\\9.1统计结果\\华安-账户信息表有效图片";
        String exportPath = "C:\\Users\\二般人\\Desktop\\9.1统计结果\\json\\";
        // 根据路径读取该路径下的所有文件
        List<File> fileList = FileUtil.getFiles(inputPath);
        log.info("=================共{}个文件：{}===================", fileList.size());
        for (int i = 0; i < fileList.size(); i++) {
            String base64 = FileUtil.fileToBase64(fileList.get(i).getAbsolutePath());
            log.info("=================开始处理第{}个文件：{}===================", (i + 1));
            Map<String, Object> param = new HashMap<>();
            param.put("image", base64);
            JSONObject jsonObject;
            try {
                HttpRequest httpRequest = HttpUtil.createPost("http://172.18.26.222:36024/hex/ocrapi/table");
                // 设定请求头
                httpRequest.header(Header.CONTENT_TYPE, "application/json");
                // 设定请求体
                httpRequest.body(JSON.toJSONString(param));
                String res1 = httpRequest.execute().body();
                String chineseRes = convertUnicodeToChinese(res1);
                File file = new File(FileUtil.RemoveFileSuffix(exportPath+fileList.get(i).getName())+".json");



                FileOutputStream fos = null;
                // 判断文件是否存在，若不存在则创建文件
                if (!file.exists()) {
                    try {
                        file.createNewFile();

                        // 将内容写入文件中
                        fos = new FileOutputStream(file);
                        fos.write(chineseRes.getBytes(StandardCharsets.UTF_8));
                    } catch (IOException e) {
                        throw new RuntimeException(e);
                    } finally {
                        if (fos != null){
                            try {
                                fos.close();
                            } catch (IOException e) {
                                throw new RuntimeException(e);
                            }
                        }
                    }
                }

            } catch (Exception e) {
                log.error("表格识别失败！" + e);
            }

        }
        tohtml();
    }


    // 华安账户信息表项目逻辑
    public void projectAccount(){
        String inputPath = "E:\\文档\\工作\\致宇\\兴证全球\\数据处理\\9.1统计结果\\华安-账户信息表有效图片";
        String exportPath = "C:\\Users\\二般人\\Desktop\\9.1统计结果\\json\\";
        // 根据路径读取该路径下的所有文件
        List<File> fileList = FileUtil.getFiles(inputPath);
        log.info("=================共{}个文件：{}===================", fileList.size());
        for (int i = 0; i < fileList.size(); i++) {
            File currentFile = fileList.get(i);
            String base64 = FileUtil.fileToBase64(fileList.get(i).getAbsolutePath());
            log.info("=================开始处理第{}个文件：{}===================", (i + 1));
            Map<String, Object> param = new HashMap<>();
            param.put("image", base64);
            JSONObject jsonObject;
            try {
                HttpRequest httpRequest = HttpUtil.createPost("http://172.18.27.128:36024/hex/ocrapi/table");
                // 设定请求头
                httpRequest.header(Header.CONTENT_TYPE, "application/json");
                // 设定请求体
                httpRequest.body(JSON.toJSONString(param));
                String res1 = httpRequest.execute().body();
                String chineseRes = convertUnicodeToChinese(res1);
//                resolveAccount(mocknewJson,currentFile.getName());
                resolveAccount(chineseRes,currentFile.getName());

            } catch (Exception e) {
                log.error("表格识别失败！" + e);
            }

        }
        tohtml();
    }

    @Override
    public void tohtml() {
        File directory = new File("C:\\Users\\二般人\\Desktop\\9.1统计结果\\json");
        String savePath = "C:\\Users\\二般人\\Desktop\\9.1统计结果\\html";
        FileProcess fileProcess = (file, savePath1) -> {
            //解析json文件
            StringBuffer jsonResult = new StringBuffer();
            try (FileInputStream fileInputStream = new FileInputStream(file);
                 InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8);
                 BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) {
                String line;
                while ((line = bufferedReader.readLine()) != null) {
                    jsonResult.append(line);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
            int index = 1;
            String fullName = file.getName();
            String fileName = fullName.substring(0,fullName.lastIndexOf("."));

            XSSFWorkbook workbook = new XSSFWorkbook();
            String result = jsonResult.toString();
            JSONObject jsonObject = JSON.parseObject(result);
            //解析json结果
//            JSONObject tableRes = jsonObject.getJSONObject("tableRes");
//            JSONArray tables = tableRes.getJSONArray("tables");
            JSONArray tables = jsonObject.getJSONArray("tableRes");
            for (int i = 0; i < tables.size(); i++){
//                Sheet sheet = workbook.createSheet();
                StringBuffer htmlResult = new StringBuffer("<table border=\"1\"><tr>");
                JSONObject table = (JSONObject) tables.get(i);
                JSONArray cells = table.getJSONArray("cells");
                //上一行的行标
                int preRowIndex = 0;
                for (int j = 0;j < cells.size();j++){
                    JSONObject cellObject = (JSONObject) cells.get(j);
//                    Integer rowStart = cellObject.getInteger("rowStart");
//                    Integer rowEnd = cellObject.getInteger("rowEnd");
//                    Integer colStart = cellObject.getInteger("colStart");
//                    Integer colEnd = cellObject.getInteger("colEnd");
//                    String text = cellObject.getString("text");
                    Integer rowStart = cellObject.getInteger("tl_row");
                    Integer rowEnd = cellObject.getInteger("br_row") + 1;
                    Integer colStart = cellObject.getInteger("tl_col");
                    Integer colEnd = cellObject.getInteger("br_col") +1;
                    String text = cellObject.getString("cell_content_text");
                    if (rowStart != preRowIndex){
                        htmlResult.append("</tr><tr>");
                        preRowIndex = rowStart;
                    }
                    if (rowStart >= 0 && rowEnd >= 0 && colStart >= 0 && colEnd >= 0){
                        htmlResult.append("<td rowspan=\""+(rowEnd - rowStart)+"\" colspan=\""+(colEnd - colStart)+"\">");
                        htmlResult.append(text);
                        htmlResult.append("</td>");
//                        Row row = sheet.getRow(rowStart);
//                        if (row == null) {
//                            row = sheet.createRow(rowStart);
//                        }
//
//                        Cell cell = row.getCell(colStart);
//                        if (cell == null) {
//                            cell = row.createCell(colStart);
//                        }
//                        cell.setCellValue(text);
                    }
                }
                htmlResult.append("</tr></table>");
                String html = htmlResult.toString();
                File htmlFile = new File(savePath+"//"+fileName+"_"+index+".html");
                if (htmlFile.exists()){
                    index++;
                    htmlFile = new File(savePath+"//"+fileName+"_"+index+".html");
                }
                try {
                    FileOutputStream os = new FileOutputStream(htmlFile);
                    byte[] bytes = html.getBytes();
                    os.write(bytes);
                    os.flush();
                    os.close();
                }catch (Exception e){
                    log.info("写文件失败");
                    e.printStackTrace();
                }
            }
        };
        listDir(directory,fileProcess,savePath);
//        writeExcel(excelPath,fileNameList);
    }

    private static void listDir(File f, FileProcess fileProcess, String savePath) {


        if (f.exists()){
            if (f.isDirectory()){
                File[] files = f.listFiles();
                for (File file : files){
                    listDir(file,fileProcess,savePath);
                }
            }else {
                fileProcess.processFile(f,savePath);
            }
        }else {
            log.info("文件不存在");
            throw new RuntimeException();
        }

    }

    public static String convertUnicodeToChinese(String unicodeStr) {
        StringBuilder sb = new StringBuilder();
        int length = unicodeStr.length();

        for (int i = 0; i < length; i++) {
            char c = unicodeStr.charAt(i);

            if (c == '\\') {
                if (i < length - 1 && unicodeStr.charAt(i + 1) == 'u') {
                    String hexStr = unicodeStr.substring(i + 2, i + 6);
                    int charValue = Integer.parseInt(hexStr, 16);
                    sb.append((char) charValue);
                    i += 5;
                } else {
                    sb.append(c);
                }
            } else {
                sb.append(c);
            }
        }

        return sb.toString();
    }

    /**
     * 项目中对账户信息表字段进行规则匹配
     * @param jsonString
     * @param fileName
     * @return
     */
    private List<BondAccount> resolveAccount(String jsonString,String fileName) {
        newAnalysisContentType(jsonString);
        List<String> allCells = JSONPath.read(jsonString,
                "$.tableRes[*].cells[?(@.tl_col >= 0  && @.tl_row > 0)].cell_content_text", List.class);

        Map<String, Object> map = makeTitleColMap(jsonString, allCells.size());
        Map<String, Integer> titleColMap = (Map<String, Integer>) map.get("titleColMap");
        int titleRowNum = (int) map.get("titleRowNum");
        String amountTitle = (String) map.get("amountTitle");

        List<Map<Integer, String>> rowMapList = new ArrayList<>();
        for (int i = titleRowNum + 1; i < allCells.size(); i++) {
            Map<Integer, String> cellMap = new HashMap<>(titleColMap.size());

            String rowJsonPath = "$.tableRes[*].cells[?(@.tl_col >= 0 && @.tl_row == " + i + ")]";
            List<JSONObject> cellList = JSONPath.read(jsonString, rowJsonPath, JSONArray.class);

            String rowStringPath = "$.tableRes[*].cells[?(@.tl_col >= 0 && @.tl_row == " + i + ")].cell_content_text";
            List<String> rowStringList = JSONPath.read(jsonString, rowStringPath, List.class);

            boolean isDirtyRow = rowStringList.stream().map(s -> s.replaceAll(" ", "")).distinct().allMatch(""::equals)
                    || rowStringList.stream().map(s -> s.replaceAll(" ", "")).distinct().allMatch(s -> s.contains("合计"));
            if (isDirtyRow) {
                break;
            }
            for (JSONObject object : cellList) {
                Integer tlCol = (Integer) object.get("tl_col");
                String cellText = (String) object.get("cell_content_text");
                cellText = cellText.replaceAll(" ", "");
                cellMap.put(tlCol, cellText);
            }
            rowMapList.add(cellMap);
        }
        return makeBondAccount(titleColMap, rowMapList, amountTitle,fileName);
    }


    private void newAnalysisContentType(String jsonString) {
        List<String> table = (List<String>) JSONPath.read(jsonString, "$.tableRes[*].cells[?(@.tl_col >= 0)].cell_content_text");
        if (!table.stream().filter(StringUtil::isNotEmpty).findAny().isPresent()) {
            System.out.println();
        }
        List<String> texts = (List<String>) JSONPath.read(jsonString, "$.tableRes[*].cells[*].cell_content_text");
        String valueText = texts.stream().filter(StringUtil::isNotEmpty).collect(Collectors.joining("-"));
        if (StringListUtils.strContainAny(valueText, Lists.newArrayList("缴款通知书", "及缴款"))) {
            System.out.println();
        }
        if (StringListUtils.strContainAny(valueText, Lists.newArrayList("帐户名称", "账户名称", "证券账户号", "证券帐户号", "证券账户号")) &&
                StringListUtils.strNotContainAny(valueText, Lists.newArrayList("开户行", "开户银行", "开户行名称"))) {
            System.out.println();
        }

        System.out.println();
    }

    private List<BondAccount> makeBondAccount(Map<String, Integer> titleColMap, List<Map<Integer, String>> rowMapList, String amountTitle,String fileName) {
        AtomicInteger counter = new AtomicInteger(0);
        List<BondAccount> bondAccounts = new ArrayList<>();
        for (Map<Integer, String> rowMap : rowMapList) {
            BondAccount bondAccount = new BondAccount();
            bondAccount.setFileName(fileName);
            bondAccount.setBondCode(titleColMap.containsKey("bondCode") ? Optional.ofNullable(rowMap.get(titleColMap.get("bondCode"))).orElse("") : "");
            /*BondFileSingle fileSingle = (BondFileSingle) fileSingleService.queryById(singleId).getData();
            String bondCode = MatchBondJob.extract(fileSingle);
            if (StringUtil.isEmpty(bondAccount.getBondCode())){
                bondAccount.setBondCode(bondCode);
            }*/
            bondAccount.setBondAbbreviation(titleColMap.containsKey("bondAbbreviation") ? Optional.ofNullable(rowMap.get(titleColMap.get("bondAbbreviation"))).orElse("") : "");
            bondAccount.setShareholderTradingAccount(titleColMap.containsKey("shareholderTradingAccount") ? Optional.ofNullable(rowMap.get(titleColMap.get("shareholderTradingAccount"))).orElse("") : "");
            bondAccount.setShareholderTradingName(titleColMap.containsKey("shareholderTradingName") ? Optional.ofNullable(rowMap.get(titleColMap.get("shareholderTradingName"))).orElse("") : "");
            if (titleColMap.containsKey("shareholderTradingName")) {
                bondAccount.setShareholderTradingName(titleColMap.containsKey("shareholderTradingName") ? Optional.ofNullable(rowMap.get(titleColMap.get("shareholderTradingName"))).orElse("") : "");
                Optional<String> shareholderTradingNameOptional = Optional.ofNullable(rowMap.get(titleColMap.get("shareholderTradingName")));
                if (shareholderTradingNameOptional.isPresent()) {
                    String shareholderTradingName = shareholderTradingNameOptional.orElse("");
                    if (StringUtils.isNotBlank(shareholderTradingName)) {
                        shareholderTradingName = matchShareholderTradingName(shareholderTradingName);
                    }
                    bondAccount.setShareholderTradingName(shareholderTradingName);
                }
            }
            if (titleColMap.containsKey("amount")) {
                Optional<String> amountOptional = Optional.ofNullable(rowMap.get(titleColMap.get("amount")));
                if (amountOptional.isPresent()) {
                    String amountStr = amountOptional.orElse("");
                    try {
                        BigDecimal amount = BigDecimal.ZERO;
                        if (StringUtil.isNotEmpty(amountStr)) {
                            amountStr = amountStr.replaceAll(",", "");
                            Pattern pattern = Pattern.compile("\\d{3,}");
                            Matcher matcher = pattern.matcher(amountStr);
                            if (matcher.find()) {
                                amountStr = matcher.group();
                            }
                            amount = new BigDecimal(amountStr);
                            if (StringListUtils.strContainAny(amountTitle, Lists.newArrayList("万元"))) {
                                amount = amount.multiply(BigDecimal.valueOf(10_000));
                            } else if (StringListUtils.strContainAny(amountTitle, Lists.newArrayList("千万"))) {
                                amount = amount.multiply(BigDecimal.valueOf(10_000_000));
                            } else if (StringListUtils.strContainAny(amountTitle, Lists.newArrayList("亿"))) {
                                amount = amount.multiply(BigDecimal.valueOf(100_000_000));
                            }
                        }
                    } catch (Exception e) {
                        log.error("金额转换失败，提取结果：{}", amountStr);
                    }
                    bondAccount.setAmount(amountStr);
                }
            }
            if (Objects.nonNull(bondAccount.getAmount())
                    && StringUtils.isNotBlank(bondAccount.getShareholderTradingAccount())
                    && (StringUtils.isNotBlank(bondAccount.getShareholderTradingName())
                    && !bondAccount.getShareholderTradingName().contains("合计"))) {
                String tradingAccount = bondAccount.getShareholderTradingAccount();
                Pattern pattern = Pattern.compile("\\w\\d{3,}");
                Matcher matcher = pattern.matcher(tradingAccount);
                if (matcher.find()) {
                    tradingAccount = matcher.group();
                    bondAccount.setShareholderTradingAccount(tradingAccount);
                }
//                insertBondAccount(batchId, singleId, imgId, pdfId, currentUserId, bondAccount);
                counter.getAndIncrement();
            }
            if (StringUtils.isBlank(bondAccount.getBondAbbreviation())
                    && StringUtils.isBlank(bondAccount.getBondCode())
                    && StringUtils.isBlank(bondAccount.getShareholderTradingAccount())
                    && StringUtils.isBlank(bondAccount.getShareholderTradingName())
                    && StringUtils.isBlank(bondAccount.getAmount())) {

            }else {
                bondAccounts.add(bondAccount);
            }
        }
        return bondAccounts;
    }

    @NotNull
    private String matchShareholderTradingName(String shareholderTradingName) {
        shareholderTradingName = shareholderTradingName.replaceAll("一", "-")
                .replaceAll("-\\..", "-")
                .replaceAll("--", "-")
                .replaceAll("\\.", "")
                .replaceAll("。","")
                .replaceAll("-年","一年")
                .replaceAll("-号","一号");
        String regex = "(?<!-)\\b.*基金.*银行.*\\b";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(shareholderTradingName);
        if (matcher.find()) {
            String matchText = matcher.group();
            shareholderTradingName = matchText
                    .replace("基金-","基金")
                    .replace("基金", "基金-");
        }

        String regex2 = "(.*(?:银行|公司))(.*)基金.*";
        Pattern pattern2 = Pattern.compile(regex2);
        Matcher matcher2 = pattern2.matcher(shareholderTradingName);
        if (matcher.find()) {
            String prefix = matcher2.group(1);
            String suffix = matcher2.group(2);
            String result = "";
            if(suffix.indexOf("-") == 0){
                result = prefix + suffix;
            }else {
                result = prefix + "-" + suffix;
            }
            shareholderTradingName = shareholderTradingName.replace(prefix+suffix,result);
        }
        return shareholderTradingName;
    }

    private static Map<String, Object> makeTitleColMap(String jsonString, Integer cellsNum) {
        Map<String, Object> map = new HashMap<>(3);
        JSONArray titleCells = null;
        int titleRowNum = 0;
        for (int i = 1; i < cellsNum + 1; i++) {
            String jsonPath = "$.tableRes[*].cells[?(@.tl_col >= 0 && @.tl_row == " + i + ")]";
            titleCells = JSONPath.read(jsonString, jsonPath, JSONArray.class);
            if (Objects.nonNull(titleCells) && titleCells.size() >= 3) {
                titleRowNum = i;
                break;
            }
        }
        /*if (Objects.isNull(titleCells) || titleCells.size() < 3) {
            log.error("未解析到账户信息表表头");
            return null;
        }*/
        Map<String, Integer> titleColMap = new HashMap<>(5);

        for (Object titleCell : titleCells) {
            JSONObject jsonObj = (JSONObject) titleCell;
            Integer colNum = (Integer) jsonObj.get("tl_col");
            String title = (String) jsonObj.get("cell_content_text");
            title = title.replaceAll(" ", "");
            if (StringListUtils.strContainAny(title,
                    Lists.newArrayList("证券账户名称", "证券帐户名称", "账户名称", "帐户名称", "证券账户名称", "证券帐户名称"))) {
                titleColMap.put("shareholderTradingName", colNum);
            } else if (StringListUtils.strContainAny(title,
                    Lists.newArrayList("股东代码", "证券账户号码", "证券帐户号码",
                            "证券账户号", "证券帐户号", "账户号码", "帐户号码", "持有人账户号", "持有人帐户号", "账户号", "帐户号"))
                    || "账号".equals(title) || "帐号".equals(title)) {
                titleColMap.put("shareholderTradingAccount", colNum);
            } else if (StringListUtils.strContainAny(title,
                    Lists.newArrayList("债券代码", "证券代码"))) {
                titleColMap.put("bondCode", colNum);
            } else if (StringListUtils.strContainAny(title,
                    Lists.newArrayList("配售金额", " 获配金额", "认购金额", "分配数量", "过户债券面值",
                            "登记金额", "债券面值", "托管数量", "金额", "万元"))) {
                titleColMap.put("amount", colNum);
                map.put("amountTitle", title);
            } else if (StringListUtils.strContainAny(title, Lists.newArrayList("证券简称", "债券简称", "债券名称", "证券名称"))) {
                titleColMap.put("bondAbbreviation", colNum);
            }
        }
        map.put("titleColMap", titleColMap);
        map.put("titleRowNum", titleRowNum);
        return map;
    }

    public static String mocknewJson = "{\n" +
            "  \"errorcode\": 0,\n" +
            "  \"errormsg\": \"OK\",\n" +
            "  \"session_id\": \"\",\n" +
            "  \"tableRes\": [\n" +
            "    {\n" +
            "      \"cells\": [\n" +
            "        {\n" +
            "          \"br_col\": 1,\n" +
            "          \"br_row\": 1,\n" +
            "          \"cell_content_text\": \"证券名称\",\n" +
            "          \"tl_col\": 1,\n" +
            "          \"tl_row\": 1\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 2,\n" +
            "          \"br_row\": 1,\n" +
            "          \"cell_content_text\": \"认购金额\",\n" +
            "          \"tl_col\": 2,\n" +
            "          \"tl_row\": 1\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 3,\n" +
            "          \"br_row\": 1,\n" +
            "          \"cell_content_text\": \"托管单元代码,! (上海)\",\n" +
            "          \"tl_col\": 3,\n" +
            "          \"tl_row\": 1\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 4,\n" +
            "          \"br_row\": 1,\n" +
            "          \"cell_content_text\": \"证券账户名称(. 上海)\",\n" +
            "          \"tl_col\": 4,\n" +
            "          \"tl_row\": 1\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 5,\n" +
            "          \"br_row\": 1,\n" +
            "          \"cell_content_text\": \"证券账户号码(上海)\",\n" +
            "          \"tl_col\": 5,\n" +
            "          \"tl_row\": 1\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 6,\n" +
            "          \"br_row\": 1,\n" +
            "          \"cell_content_text\": \"注册号/批文号\",\n" +
            "          \"tl_col\": 6,\n" +
            "          \"tl_row\": 1\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 1,\n" +
            "          \"br_row\": 2,\n" +
            "          \"cell_content_text\": \"惠沣7A2\",\n" +
            "          \"tl_col\": 1,\n" +
            "          \"tl_row\": 2\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 2,\n" +
            "          \"br_row\": 2,\n" +
            "          \"cell_content_text\": \"| | ,000.000.00\",\n" +
            "          \"tl_col\": 2,\n" +
            "          \"tl_row\": 2\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 3,\n" +
            "          \"br_row\": 2,\n" +
            "          \"cell_content_text\": \"24936\",\n" +
            "          \"tl_col\": 3,\n" +
            "          \"tl_row\": 2\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 4,\n" +
            "          \"br_row\": 2,\n" +
            "          \"cell_content_text\": \"华安基金一兴业银行一.上海农村商业银行股份有.限公司\",\n" +
            "          \"tl_col\": 4,\n" +
            "          \"tl_row\": 2\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 5,\n" +
            "          \"br_row\": 2,\n" +
            "          \"cell_content_text\": \"B888339 130\",\n" +
            "          \"tl_col\": 5,\n" +
            "          \"tl_row\": 2\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 6,\n" +
            "          \"br_row\": 2,\n" +
            "          \"cell_content_text\": \"SE8744\",\n" +
            "          \"tl_col\": 6,\n" +
            "          \"tl_row\": 2\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 1,\n" +
            "          \"br_row\": 3,\n" +
            "          \"cell_content_text\": \"惠沣7A3\",\n" +
            "          \"tl_col\": 1,\n" +
            "          \"tl_row\": 3\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 2,\n" +
            "          \"br_row\": 3,\n" +
            "          \"cell_content_text\": \"27.000.000.00\",\n" +
            "          \"tl_col\": 2,\n" +
            "          \"tl_row\": 3\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 3,\n" +
            "          \"br_row\": 3,\n" +
            "          \"cell_content_text\": \"24936\",\n" +
            "          \"tl_col\": 3,\n" +
            "          \"tl_row\": 3\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 4,\n" +
            "          \"br_row\": 3,\n" +
            "          \"cell_content_text\": \"华安基金一- 兴业银行.上海农村商业银行股份有限公司\",\n" +
            "          \"tl_col\": 4,\n" +
            "          \"tl_row\": 3\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 5,\n" +
            "          \"br_row\": 3,\n" +
            "          \"cell_content_text\": \"B888339 I 30\",\n" +
            "          \"tl_col\": 5,\n" +
            "          \"tl_row\": 3\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 6,\n" +
            "          \"br_row\": 3,\n" +
            "          \"cell_content_text\": \"SE8744\",\n" +
            "          \"tl_col\": 6,\n" +
            "          \"tl_row\": 3\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 1,\n" +
            "          \"br_row\": 4,\n" +
            "          \"cell_content_text\": \"\",\n" +
            "          \"tl_col\": 1,\n" +
            "          \"tl_row\": 4\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 2,\n" +
            "          \"br_row\": 4,\n" +
            "          \"cell_content_text\": \"\",\n" +
            "          \"tl_col\": 2,\n" +
            "          \"tl_row\": 4\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 3,\n" +
            "          \"br_row\": 4,\n" +
            "          \"cell_content_text\": \"\",\n" +
            "          \"tl_col\": 3,\n" +
            "          \"tl_row\": 4\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 4,\n" +
            "          \"br_row\": 4,\n" +
            "          \"cell_content_text\": \"\",\n" +
            "          \"tl_col\": 4,\n" +
            "          \"tl_row\": 4\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 5,\n" +
            "          \"br_row\": 4,\n" +
            "          \"cell_content_text\": \"\",\n" +
            "          \"tl_col\": 5,\n" +
            "          \"tl_row\": 4\n" +
            "        },\n" +
            "        {\n" +
            "          \"br_col\": 6,\n" +
            "          \"br_row\": 4,\n" +
            "          \"cell_content_text\": \"\",\n" +
            "          \"tl_col\": 6,\n" +
            "          \"tl_row\": 4\n" +
            "        }\n" +
            "      ]\n" +
            "    }\n" +
            "  ]\n" +
            "}\n";
}
